package com.jiangyg.mall.product.enums;

/**
 * 类描述：发布状态
 *
 * @author jiangyg
 * @date 2021-12-05
 */
public enum Published {

    /**
     * 上架
     */
    UP(1),

    /**
     * 下架
     */
    DOWN(0);

    /**
     * 代码
     */
    public final int code;

    Published(int code) {
        this.code = code;
    }

    /**
     * 功能描述：根据代码判断值
     *
     * @param code 代码
     * @return Published
     */
    public static Published decide(int code) {
        for (Published item : Published.values()) {
            if (item.code == code) {
                return item;
            }
        }
        return null;
    }

}
